#ifndef _lowLevelPwm_h
#define _lowLevelPwm_h

// The following is valid for PIO0_7 using CT32B1
#define PWM_TIMER_CLOCK_CONTROL_INDEX       		10
#define PWM_TIMER                                   LPC_CT32B1
#define PWM_TIMER_IRQ                               TIMER_32_1_IRQn

#define PWM_TCR_RESET   (1 << 2)

#define PWM_MR0              0
#define PWM_MR1              1
#define PWM_MR2              2
#define PWM_MR3              3
#define PWM_MCR_MATCH_INT    (1 << 0)
#define PWM_MCR_MATCH_RESET  (1 << 1)
#define PWM_MCR_MATCH_STOP   (1 << 2)

#define PWM_MCR_SET_MATCH_N(n, val) PWM_TIMER->MCR |= (val << (3*n))

#define PWM_MAT_ZERO         0
#define PWM_MAT_ONE          1
#define PWM_MAT_TWO          2
#define PWM_MAT_THREE        3
#define PWM_ENABLE_OUTPUT_N(n) PWM_TIMER->PWMC |= (1 << n)


extern void lowLevelPwm_init(void);

#endif  // _lowLevelPwm_h
